# 设置CMake的最低版本  
cmake_minimum_required(VERSION 3.0)  
  
# 定义项目名称和编程语言  
project(TCMALLOC)  
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_BUILD_TYPE Debug)
set(LIB ${PROJECT_SOURCE_DIR}/src/Central_Cache.cpp ${PROJECT_SOURCE_DIR}/src/Page_Cache.cpp ${PROJECT_SOURCE_DIR}/src/Thread_Cache.cpp)

# 输出路径
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)

aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC)

# 添加头文件搜索路径  
include_directories(${PROJECT_SOURCE_DIR}/include)  
  
# 添加源文件到可执行文件  
add_executable(tcmalloc ${SRC})

add_library(tcmalloclib SHARED ${LIB})

target_link_libraries(tcmalloc pthread)
